home *** CD-ROM | disk | FTP | other *** search
- {$A+,B-,D-,E-,F-,G+,I-,L-,N-,O-,R-,S-,V+,X-}
- Unit Timer;
- Interface
- Uses Dos;
-
- { (c) Emilio David Diaus López }
- { Temporizadores para el control del tiempo }
- {
- 11. Timer: El Control Del Tiempo En El Programa
-
- Este MóDulo Provee Diez Temporizadores Para Controlar El Tiempo, En Este Programa
- Mdisk Se Utilizan Para Controlar El Tiempo.
- Inittimer;
- Activa El Temporizador Con El NúMero Timer.
- Gettimer;
- Devuelve El NúMero De CentéSimas Pasadas Desde La ActivacióN Por
- Medio De Inittimer;
- Get_Timer_Vars;
- Devuelve El Tiempo Pasado Desde La ActivacióN Por Medio De Inittimer;
- En Horas, Minutos, Segundos Y CentéSimas.
- }
-
- { Contadores }
- Var Itimer,Ftimer,Rtimer:Array[0..10] Of Longint;
-
- { Inicia un contador de tiempo }
- Procedure Inittimer(Timer:Byte);
- { obtiene tiempo de un contador de tiempo }
- Function Gettimer(Timer:Byte):Longint;
-
- { obtiene tiempo en horas, minutos y segundos }
-
- Procedure Get_Timer_Vars(Timer:Byte;Var H,M,S,Cs:Word);
-
- Implementation
-
- Procedure Inittimer(Timer:Byte);
- Var H,M,S,Cs:Word;
- Begin
- Gettime(H,M,S,Cs);
- Itimer[Timer]:=Cs+S*100+M*100*60+H*100*60*60;
- End;
-
- Function Gettimer(Timer:Byte):Longint;
- Var H,M,S,Cs:Word;
- Begin
- Gettime(H,M,S,Cs);
- Ftimer[Timer]:=Cs+S*100+M*100*60+H*100*60*60;
- Rtimer[Timer]:=Ftimer[Timer]-Itimer[Timer];
- Gettimer:=Rtimer[Timer];
- End;
-
- Procedure Get_Timer_Vars(Timer:Byte;Var H,M,S,Cs:Word);
- Var Time:Longint;
- Begin
- Time:=Gettimer(Timer);
- H:=Word(Time Div 360000);
- Time:=Word(Time Mod 360000);
- M:=Word(Time Div 6000);
- Time:=Word(Time Mod 6000);
- S:=Word(Time Div 100);
- Time:=Word(Time Mod 100);
- Cs:=Time;
- End;
-
- End.
-